Repository navigation
scripts: pr_overlap.py lists the open pull requests that change the same files (PR-OVERLAP-CHECK) - #2349
scripts: pr_overlap.py lists the open pull requests that change the same files (PR-OVERLAP-CHECK)#2349syfyra wants to merge 1 commit into
Conversation
…ame files (PR-OVERLAP-CHECK) There was no working way to find the open pull requests that touch a file: GitHub's search does not match pull requests by path, and with about 1,490 of them open, reading them is not an option. Work gets written twice, and the template's "Depends on:" line (every pull request this one conflicts with) is filled in from memory. scripts/pr_overlap.py asks git instead, with no API call and no token. The open pull requests are the ones the remote has a refs/pull/N/merge for; their heads are fetched into refs/pr-overlap/N, a namespace of the tool that follows the open set, so --no-fetch works offline. A pull request's files are those that differ between its head and its merge base with the base branch. With paths it lists the open pull requests that change them. With none it takes the branch's own files, committed or in the working tree, and says how the branch stands to each pull request that changes one: clean or conflict (git merge-tree, with the conflicting files), same, or included. AGENTS.md and CONTRIBUTING.md name it where they ask to check the open pull requests. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
lixonik
left a comment
There was a problem hiding this comment.
Windows 11: 19/19 overlap tests passed. The suite used disposable local Git repos for ref discovery, dirty path handling, overlap and ref cleanup. No findings from these checks.
AI-assisted.
aslan2142
left a comment
There was a problem hiding this comment.
Draft review note: PR-OVERLAP-CHECK (scripts/pr_overlap.py, tests/test_pr_overlap.py, AGENTS.md, CONTRIBUTING.md) is cleanly scoped, mergeable on main, and passed independent unit tests, but remains a draft with no CI run. Please run CI to green and mark ready for review when ready.
(AI-assisted review.)
|
Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. (AI-assisted triage.) |
aslan2142
left a comment
There was a problem hiding this comment.
Now ready for review and MERGEABLE. Clean-room verified: scripts/pr_overlap.py, doc notes in AGENTS.md/CONTRIBUTING.md, and 19/19 disposable-repo tests are clean and verified (@lixonik).
Approving — ready to merge once CI runs green on current main.
(AI-assisted review.)
|
Checked a working-tree-only overlap and the current documentation conflict at AI-assisted with OpenAI Codex. |
Claimed in the coordination issue as: PR-OVERLAP-CHECK (#1608 (comment))
Depends on: none. It merges cleanly with the two open pull requests that change the same files (#2103 in
AGENTS.md, #2151 inAGENTS.mdandCONTRIBUTING.md), as the script itself reports.What and why
There is no working way to find the open pull requests that touch a file. GitHub's search does not match pull requests by path: the VIEWER-HUNT finding in the coordination issue records
gh search prs 'path:viewer/'returning nothing while four open pull requests changed those files. With about 1,490 pull requests open, reading them is not an option, so work gets written twice, and the template'sDepends on:line (every pull request this one builds on or conflicts with) is filled in from memory.scripts/pr_overlap.pyasks git instead, with no API call and no token:refs/pull/N/mergefor. GitHub keeps that ref while a pull request is open:git ls-remoteshowed 1,485 of them today (of 2,283 pull request heads), against 1,484 open pull requests in the search API, 317 of them labeledneeds rebase.refs/pr-overlap/N, a namespace of the tool. Refs of pull requests that are no longer open are deleted, so the namespace is the open set as of the last run and--no-fetchworks offline.--base(defaultorigin/main), so whatmainchanged since it branched is not counted as its own. A rename counts as both paths.python -I scripts/pr_overlap.py <file or folder>...lists the open pull requests that change those paths: the check to run before starting on a file. With no argument it takes the branch's own files (committed against the merge base, plus what is modified or untracked in the working tree) and says how the branch stands to each pull request that changes one of them:cleanorconflictfromgit merge-tree, with the conflicting files,samefor the branch's own pull request,includedfor one the branch is built on.--jsongives the same as one object.It writes refs under
refs/pr-overlap/and nothing else: no tags, noFETCH_HEAD, and no pull request code is checked out or run.AGENTS.mdandCONTRIBUTING.mdname it where they ask to check the open pull requests.What it found on real branches here:
scripts/run_semantic_tests.py), whose description names one conflicting pull request, it lists 21 open pull requests on the same three files, 8 of which conflict with that branch.AGENTS.md. I moved my paragraph to the end of that section, and it now reports both pull requests as clean.viewer/serve.pyit lists none, which is what the VIEWER-HUNT finding concluded by hand.Tested
Windows 11, Python 3.14.7, git 2.55.0:
python -I tests/test_pr_overlap.py: 19 tests on throwaway repositories, an "upstream" withrefs/pull/N/headandrefs/pull/N/mergelaid out as GitHub does and a clone of it. They cover paths and folders, closed pull requests left out, files measured from the merge base, renames, paths relative to the current folder and with spaces and non-ASCII names, the branch mode with committed, modified and untracked files, the four standings, the kept refs following the open set,--no-fetchwith the remote gone, a fork asorigin, a shallow clone, and the errors.main, where the script does not exist.--no-fetchabout 4.6 s. The first run fetched 1,487 heads and took 12 s, in a clone that already had most of their objects from an earlier fetch of the pull request refs; a clone without them will take longer.python -Iontests/test_tool_stdout_encoding.py,tests/test_text_write_line_endings.py,tests/test_ci_registration.py, the 13tests/test_docs_*.pyandtests/test_i18n_index.py;python -I scripts/check_no_game_data.pyon the four changed files.contextlib.chdirin the test needs 3.11), a git older than 2.55 (2.29 forfetch --stdinand 2.38 formerge-tree --write-treeare from git's release notes, not from a run), and a host other than GitHub (the merge-ref rule is GitHub's).GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator rule in this change.)🤖 Generated with Claude Code